<template>
	<div class="wrap">
		<div class="content">
			<div class="com" v-for="item in list" :key="item.id" >
				<div class="left" style="padding-left: 10rpx; ">
					<p>
						 <span>{{item.linkMan}}</span>
						 <span style="margin-left: 10rpx;">{{item.mobile}}</span>
					</p>
					<p>{{item.provinceStr}}{{item.areaStr}}{{item.address}}</p>
				</div>
				<div class="right">
					<u-icon name="edit-pen" @click="editaddress"></u-icon>
				</div>
			</div>
		</div>
		<div class="bom">
			<button @click="addAddress">+新增收货地址</button>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
              list:[]
			}
		},
		methods: { 
			 
	  //    cli(val){
			//  console.log(val.id);
		 // },
		 getData() {
		 	let that = this;
		 	// console.log(uni.getStorageSync("token"));
		 	// let tokened=uni.getStorageSync("token");
		 	uni.request({
		 		url: "https://api.it120.cc/xiaochengxu/user/shipping-address/list/v2?token=a8d38f3f-31fd-44aa-90c4-7d5b2e5d8b2a",
		 		method: "post",
		 
		 		// data:{
		 		// 	list:[]
		 		// },
		 		dataType: "json",
		 		header: {
		 			'Content-Type': 'application/x-www-form-urlencoded'
		 		},
		 		success(res) {
		 			// data=res.data;
		 			that.list = res.data.data.result;
		 			// console.log(this.list);
		 			console.log(that.list)
		 			// }
					// console.log(res)
		 		},
		 		fail: function(err) {
		 			console.log(err);
		 		}
		 	})
		 },
         addAddress(){
			 uni.navigateTo({
			 	url: "/pages/addAddress/addAddress"
			 })
		 },
		 editaddress(){
		 console.log(1);
			// console.log(val.id);
			uni.navigateTo({
				url:'/pages/addAddress/addAddress'
			})
			
		 }
		},
			
		mounted(){
			this.getData();
		}	
		
	}
</script>

<style scoped>
	.wrap {
		width: 100vw;
		height: 100vh;
		background: rgb(247, 248, 250);
	}

	.content {
		width: 100%;
		height: 80%;
	}

	.com {
		border-radius: 20rpx;
		width: 90%;
		height: 150rpx;
		margin: 0 auto;
		margin-top: 10rpx;
		display: flex;
		align-items: center;
		background: white;
	}
		
    .left{
		display: flex;
        flex-direction: column;
		/* align-items: center; */
  		width: 88%;
		height: 100%;
	}
	.left p{
		margin-top: 30rpx;
		font-size: 25rpx;
	}
		.left p span{
			font-size: 25rpx;
		}
	.bom{
		width: 100%;
		height: 80rpx;
		position: fixed;
		bottom: 0;
	}
		
	.bom button{
		width: 80%;
		height: 80rpx;
		color: white;
		font-size: 25rpx;
		line-height: 80rpx;
		background: rgb(27,167,132);
		border-radius: 40rpx;
	}
</style>